package net.sf.ivyide;

/**
 * User: janssk1
 * Date: 18-okt-2010
 * Time: 15:01:36
 */
public class ModuleId {

    private final String name;
    private final String organisation;

    public ModuleId(String organisation, String name) {
        this.name = name;
        this.organisation = organisation;
    }

    public String getName() {
        return name;
    }

    public String getOrganisation() {
        return organisation;
    }

    public String toString() {
        return organisation + "#" + name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ModuleId moduleId = (ModuleId) o;

        if (!name.equals(moduleId.name)) return false;
        if (!organisation.equals(moduleId.organisation)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = name.hashCode();
        result = 31 * result + organisation.hashCode();
        return result;
    }
}
